<template>
    <div class="aftersale_lookIfo-box">
        <!--      查询表单 -->
        <div class="search-form">
            <el-form :inline="true" class="demo-form-inline" size="mini">

                <el-form-item label="售后出库订单编号">
                    <el-input placeholder="请输入订单编号" v-model="searchParams.id"></el-input>
                </el-form-item>

                <el-form-item label="售后出库订单类型">
                    <!--动态渲染  选择订单类型-->
                    <el-select  placeholder="选择订单类型" v-model="searchParams.outType">
                        <el-option v-for="(key,value) in outTypeList" :label="key" :value="value" :key="key"></el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="售后出库订单状态">
                    <!--动态渲染  选择订单类型-->
                    <el-select  placeholder="选择订单状态" v-model="searchParams.outStatus">
                        <el-option v-for="(key,value) in outStatusList" :label="key" :value="value" :key="key"></el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="售后出库订单日期">
                    <el-date-picker
                            style="width: 240px"
                            type="datetimerange"
                            :picker-options="dateOptions.pickerOptions"
                            v-model="dateOptions.startDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            range-separator="-"
                            @change="chooseTime"
                            start-placeholder="开始日期"
                            end-placeholder="结束日期"
                            align="left">
                    </el-date-picker>
                </el-form-item>
                <!--        <el-form-item label="活动区域">-->
                <!--          <el-select  placeholder="活动区域">-->
                <!--            <el-option label="区域一" value="shanghai"></el-option>-->
                <!--            <el-option label="区域二" value="beijing"></el-option>-->
                <!--          </el-select>-->
                <!--        </el-form-item>-->
                <el-form-item>
                    <el-button type="primary" @click="searchPage">查询</el-button>
                    <el-button type="warning" @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>
        </div>

        <!--    操作功能 -->
        <div class="crud-box">
            <el-button type="primary" size="mini" icon="el-icon-edit" @click="dialogVisible=true,formData={},selectIds=[]">新建</el-button>
            <el-button type="success" size="mini" icon="el-icon-edit" :disabled="batchIds.length!=1" @click="dialogVisible=true,findById()">修改</el-button>
            <el-button type="danger" size="mini" icon="el-icon-delete" :disabled="batchIds.length<=0"
                       @click="showBatchDeleteDialog">删除
            </el-button>
        </div>

        <!--    表格数据-->
        <div class="data-box">
            <el-table
                    :data="tableData"
                    style="width: 100%"
                    @selection-change="selectChange">
                <el-table-column
                        align="center"
                        type="selection"
                        width="55">
                </el-table-column>

                <el-table-column
                        type="index"
                        width="55"
                        label="序号">
                </el-table-column>

                <el-table-column
                        align="center"
                        prop="id"
                        label="售后出库订单编号"
                        width="180">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="outType"
                        label="售后出库订单类型"
                        width="180">
                </el-table-column>
                <el-table-column
                        align="center"
                        prop="outStatus"
                        label="售后出库订单状态"
                        width="180">
                </el-table-column>

                <el-table-column
                        align="center"
                        prop="outTime"
                        label="订单日期"
                        width="180">
                </el-table-column>

                <el-table-column

                        label="操作">
                    <template v-slot="hanjie">
                        <el-button type="primary" size="mini" icon="el-icon-edit" style="margin-right: 10px" @click="dialogVisible=true,
                        formData.id=hanjie.row.id,findById()">修改</el-button>
                        <el-popconfirm
                                confirm-button-text='确定'
                                cancel-button-text='取消'
                                icon="el-icon-info"
                                icon-color="red"
                                @confirm="deleteById"
                                placement="top"
                                title="是否要删除本条记录？"
                        >
                            <el-button slot="reference" type="danger" size="mini" @click="formData.id=hanjie.row.id"
                                       icon="el-icon-delete">删除</el-button>
                        </el-popconfirm>
                    </template>
                </el-table-column>
            </el-table>
        </div>

        <!--    分页-->
        <div class="page-box">
            <el-pagination
                    background
                    layout="prev, pager, next"
                    :total="total"
                    :page-size="searchParams.pageSize"
                    :current-page="searchParams.currentPage"
                    @current-change="currentPageChange"
            >
            </el-pagination>
        </div>


        <el-dialog
                title="实体操作"
                :visible.sync="dialogVisible"
                width="38%"
        >
            <el-form ref="form" label-width="80px" :model="formData" size="small">

                <el-form-item label="选择售后出库订单类型">
                    <!--动态渲染  选择订单类型-->
                    <el-select  placeholder="选择订单类型" v-model="formData.outType">
                        <el-option v-for="(key,value) in outTypeList" :label="key" :value="value" :key="key"></el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="售后入库订单状态">
                    <!--动态渲染  选择订单状态-->
                    <el-select  placeholder="选择订单状态" v-model="formData.outStatus"  >
                        <el-option v-for="(key,value) in outStatusList" :label="key" :value="value" :key="key"></el-option>
                    </el-select>
                </el-form-item>

                <el-form-item label="返厂后串码">
                    <el-input v-model="formData.outSn"></el-input>
                </el-form-item>

                <el-form-item label="订单日期">
                    <el-date-picker

                            v-model="formData.outTime"
                            type="datetime"
                            placeholder="选择日期时间"
                            value-format="yyyy-MM-dd HH:mm:ss"
                    >
                    </el-date-picker>
                </el-form-item>
            </el-form>


            <span slot="footer" class="dialog-footer">
        <el-button size="mini" @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" size="mini" @click="dialogVisible = false,addOrEdit()">确 定</el-button>
  </span>
        </el-dialog>
    </div>
</template>

<script>
    import brand from "./index";

    export default brand;
</script>

<style scoped>

</style>